package com.higold.cloud.ui.activity

import android.content.Intent
import android.support.design.widget.BottomSheetBehavior
import com.higold.cloud.R
import com.higold.cloud.base.BaseActivity
import com.higold.cloud.utils.StatusBarUtil
import kotlinx.android.synthetic.main.activity_login.*
import android.view.View
import android.util.DisplayMetrics
import kotlinx.android.synthetic.main.phone_login_sheet.*


/**
 *    author : lxz
 *    date   : 2019/5/22 9:33
 *    desc   : 登录界面
 */

class LoginActivity : BaseActivity() {

    override fun layoutId(): Int = R.layout.activity_login

    override fun initData() {

    }

    override fun initView() {
        //状态栏透明和间距处理
        this.let { StatusBarUtil.darkMode(it) }
        this.let { StatusBarUtil.setPaddingSmart(it, toolbar) }

        val outMetrics = DisplayMetrics()
        windowManager.defaultDisplay.getMetrics(outMetrics)
        val bottomSheetBehavior = BottomSheetBehavior.from<View>(content_nv)
        bottomSheetBehavior.peekHeight = outMetrics.heightPixels
        bottomSheetBehavior.isHideable = true
        bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN

        ll_phone_login.setOnClickListener { bottomSheetBehavior.state = BottomSheetBehavior.STATE_EXPANDED }
        bt_login.setOnClickListener { redirectTo() }
    }

    override fun start() {

    }

    private fun redirectTo() {
        val intent = Intent(this, NewMainActivity::class.java)
        startActivity(intent)
        finish()
    }


}